package com.zoe.app.filters.filter;

import com.zoe.app.context.OrderContext;
import com.zoe.app.domain.Order;
import lombok.extern.slf4j.Slf4j;

/**
 * @author zbg
 * @date 2023/06/06
 * @description
 */
@Slf4j
public class OneFilter extends AbsFilter<OrderContext> {
    @Override
    public void handler(OrderContext ctx) {
        if (ctx.getFilterSelector().match(getFilterName())) {
            Order order = ctx.getOrder();
            Integer bigDecimal = order.getBigDecimal();
            order.setBigDecimal(bigDecimal - 10);
            log.info("订单金额减少 --> {}", order.getBigDecimal());
        }
    }
}
